package com.office.meeting.video.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.office.common.annotation.Log;
import com.office.common.core.controller.BaseController;
import com.office.common.core.domain.AjaxResult;
import com.office.common.enums.BusinessType;
import com.office.meeting.video.domain.VideoConference;
import com.office.meeting.video.service.IVideoConferenceService;
import com.office.common.utils.poi.ExcelUtil;
import com.office.common.core.page.TableDataInfo;

/**
 * 视频会议Controller
 *
 * @author 柒月
 * @date 2025-05-23
 */
@RestController
@RequestMapping("/videotape/recording")
public class VideoConferenceController extends BaseController {
    @Autowired
    private IVideoConferenceService videoConferenceService;

    /**
     * 查询视频会议列表
     */
    @PreAuthorize("@ss.hasPermi('videotape:recording:list')")
    @GetMapping("/list")
    public TableDataInfo list(VideoConference videoConference) {
        startPage();
        List<VideoConference> list = videoConferenceService.selectVideoConferenceList(videoConference);
        return getDataTable(list);
    }

    /**
     * 导出视频会议列表
     */
    @PreAuthorize("@ss.hasPermi('videotape:recording:export')")
    @Log(title = "视频会议", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, VideoConference videoConference) {
        List<VideoConference> list = videoConferenceService.selectVideoConferenceList(videoConference);
        ExcelUtil<VideoConference> util = new ExcelUtil<VideoConference>(VideoConference.class);
        util.exportExcel(response, list, "视频会议数据");
    }

    @PreAuthorize("@ss.hasPermi('videotape:recording:enter')")
    @GetMapping("/enter/{id}/{password}")
    public AjaxResult enter(@PathVariable Long id, @PathVariable String password) {
        return AjaxResult.success(videoConferenceService.selectVideoConferenceById(id, password));
    }
}
